//
//  FooterView.m
//  IOS-7day
//
//  Created by RIOS on 2018/5/2.
//  Copyright © 2018年 RIOS. All rights reserved.
//

#import "FooterView.h"

@interface FooterView  ()

- (IBAction)moreClick:(id)sender;
@property (weak, nonatomic) IBOutlet UIButton *vMore;

@property (weak, nonatomic) IBOutlet UIActivityIndicatorView *vIndicator;
@property (weak, nonatomic) IBOutlet UILabel *vLoading;

@end

@implementation FooterView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

+ (instancetype)buildView{
    return [[[NSBundle mainBundle] loadNibNamed:@"footerView" owner:nil options:nil]firstObject];
}

- (IBAction)moreClick:(id)sender {
    self.vMore.hidden = true;
    self.vIndicator.hidden = false;
    self.vLoading.hidden = false;
    
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        if ([self.delegate respondsToSelector:@selector(footerViewUpdate:)]) {
            [self.delegate footerViewUpdate:self];
            self.vMore.hidden = false;
            self.vIndicator.hidden = true;
            self.vLoading.hidden = true;
        }
    });
    
    
}
@end
